package xc.utils;

import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;

public class JdbcTest {
    @Test
    public void testJdbc() throws Exception {
        // 注册驱动
        Class.forName("com.mysql.cj.jdbc.Driver");

        // 获取数据库连接
        String url="jdbc:mysql://192.168.10.100:3306/bathingspot";
        String username = "root";
        String password = "Woaixuexi@1";
        Connection connection = DriverManager.getConnection(url, username, password);

        // 释放资源
        connection.close();
    }
}

